﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jumpton.SFA.Server.BusinessRule.MasterData;
using Jumpton.SFA.Server.Entity;
using Jumpton.SFA.Server.BusinessRule;

public partial class Inventory_Target_List : PageBase
{

    private const string RESPONSE_LIST_MAINTAIN_PAGE = "Inventory_Targe_Maintain.aspx";
    private const string RESPONSE_EDIT_PSKU = "Inventory_Target_Product_List.aspx";
    private const string RESPONSE_ASSIGN_CUSTOMER = "Inverntory_Target_Customer.aspx";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGrid();
        }
    }


    private void BindGrid()
    {

        gvChannelType.DataSource = IcoProfileManager.GetAllIcoProfileList(MyStateManager.DomainID);
        gvChannelType.DataBind();
    }

    protected void btnNew_Click(object sender, EventArgs e)
    {
        Response.Redirect(RESPONSE_LIST_MAINTAIN_PAGE);
    }



    protected void gvChannelType_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        object oID = e.CommandArgument;
        if (oID != null)
        {
            if (e.CommandName == "EditPSKU")
            {
                Response.Redirect(RESPONSE_EDIT_PSKU+"?id="+oID.ToString());
            }
            else if (e.CommandName == "AssignCustomer")
            {
                Response.Redirect(RESPONSE_ASSIGN_CUSTOMER+"?id="+oID.ToString());
            }
        }
    }
    protected void gvChannelType_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvChannelType.PageIndex = e.NewPageIndex;
        BindGrid();
    }
}

